package com.ruoyi.factorydata.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import java.util.List;

import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.factorydata.mapper.CraftProcessMaterialRelationMapper;
import com.ruoyi.factorydata.domain.CraftProcessMaterialRelation;
import com.ruoyi.factorydata.service.ICraftProcessMaterialRelationService;

/**
 * 工艺工序物料Service业务层处理
 *
 * @author ruoyi
 * @date 2025-07-15
 */
@Service
public class CraftProcessMaterialRelationServiceImpl extends ServiceImpl<CraftProcessMaterialRelationMapper, CraftProcessMaterialRelation> implements ICraftProcessMaterialRelationService {
    @Autowired
    private CraftProcessMaterialRelationMapper craftProcessMaterialRelationMapper;

    /**
     * 查询工艺工序物料
     *
     * @param id 工艺工序物料主键
     * @return 工艺工序物料
     */
    @Override
    public CraftProcessMaterialRelation selectCraftProcessMaterialRelationById(Long id) {
        return craftProcessMaterialRelationMapper.selectCraftProcessMaterialRelationById(id);
    }

    /**
     * 查询工艺工序物料列表
     *
     * @param craftProcessMaterialRelation 工艺工序物料
     * @return 工艺工序物料
     */
    @Override
    public List<CraftProcessMaterialRelation> selectCraftProcessMaterialRelationList(CraftProcessMaterialRelation craftProcessMaterialRelation) {
        return craftProcessMaterialRelationMapper.selectCraftProcessMaterialRelationList(craftProcessMaterialRelation);
    }

    /**
     * 新增工艺工序物料
     *
     * @param craftProcessMaterialRelation 工艺工序物料
     * @return 结果
     */
    @Override
    public int insertCraftProcessMaterialRelation(CraftProcessMaterialRelation craftProcessMaterialRelation) {
                craftProcessMaterialRelation.setCreateTime(DateUtils.getNowDate());
            return craftProcessMaterialRelationMapper.insertCraftProcessMaterialRelation(craftProcessMaterialRelation);
    }

    /**
     * 修改工艺工序物料
     *
     * @param craftProcessMaterialRelation 工艺工序物料
     * @return 结果
     */
    @Override
    public int updateCraftProcessMaterialRelation(CraftProcessMaterialRelation craftProcessMaterialRelation) {
                craftProcessMaterialRelation.setUpdateTime(DateUtils.getNowDate());
        return craftProcessMaterialRelationMapper.updateCraftProcessMaterialRelation(craftProcessMaterialRelation);
    }

    /**
     * 批量删除工艺工序物料
     *
     * @param ids 需要删除的工艺工序物料主键
     * @return 结果
     */
    @Override
    public int deleteCraftProcessMaterialRelationByIds(Long[] ids) {
        return craftProcessMaterialRelationMapper.deleteCraftProcessMaterialRelationByIds(ids);
    }

    /**
     * 删除工艺工序物料信息
     *
     * @param id 工艺工序物料主键
     * @return 结果
     */
    @Override
    public int deleteCraftProcessMaterialRelationById(Long id) {
        return craftProcessMaterialRelationMapper.deleteCraftProcessMaterialRelationById(id);
    }
}